package model.album;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import model.admin.OptionalServiceVO;
import model.album.AlbumListVO;
import model.album.AlbumPagingBean;
import model.album.HappyalbumVO;

public class HappyAlbumService {
	private HapptAlbumDao happtAlbumDao;

	public HappyAlbumService(HapptAlbumDao happtAlbumDao) {
		super();
		this.happtAlbumDao = happtAlbumDao;
	}
	public AlbumListVO HappyTimeAlbumList(String pagetest, int no) throws SQLException {
		int page=0;
		if(pagetest==null){
			page=1;
		}else{
			page = Integer.parseInt(pagetest);
		}
		HashMap map = new HashMap();
		map.put("page", page);
		map.put("no", no);
		System.out.println("맵 최종값"+map.toString());
		List<HappyalbumVO> list = happtAlbumDao.HappyTimeAlbumList(map);
		System.out.println("최종값"+list.toString());
		AlbumListVO listVO = new AlbumListVO();
		int totalContent = happtAlbumDao.getTotalContetn(no);
		AlbumPagingBean pagingBean = new AlbumPagingBean(totalContent, page);
		listVO.setPagingBean(pagingBean);
		listVO.setList(list);
		return listVO;
		
	}
	public boolean getIds(HashMap map) throws SQLException {
		OptionalServiceVO optionalServiceVO = happtAlbumDao.getIds(map);
		boolean flag = true;
		if(optionalServiceVO==null){
			flag = false;
		}
		return flag;
	}

}
